package com.algorithm;

public class Stack {
    private int[] stack = new int[10];
    private int head = 0;

    public void push(int i) {
        stack[head] = i;
        head++;
    }

    public int pop() {
        int top = stack[head];
        stack[head] = 0;
        head--;
        return top;
    }
    
    public void disp() {
        for (int i = 0; i < head; i++) {
            System.out.println(stack[i]);
        }
    }

    public static void main(String[] args) {
        Stack stack = new Stack();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.pop();
        stack.pop();
        
        stack.disp();
    }
}
